import 'dart:convert';

import 'package:any_reader/public.dart';

import '../provider/export.dart';
import '../views/components/moments_item.dart';
import 'export.dart';

class HomeModel extends ViewStateRefreshListModel {
  ThemeModel themeModel;
  HomeModel(this.themeModel);
  @override
  iniData() {
    // TODO: implement iniData
    FlutterStatusbarManager.setColor(themeModel.customThemeData.mainColor);
    return super.iniData();
  }

  @override
  Future<List> loadData({int pageNum}) async {
    await Future.delayed(Duration(milliseconds: 500));
    print("pageNum ${pageNum.toString()}");
    List<Data> _l = [];
    var json =
        '{"code":200,"data":[{"id":1,"title":"阿波罗","content":"登月成功"},{"id":1,"title":"阿波罗","content":"登月成功23333"}],"message":"获取成功！"}';
    Map<String, dynamic> jsonObject = jsonDecode(json);

    _l = Data.listFromJson(jsonObject['data']);
    return Future.value(_l);
  }
}
